﻿using myapp_common;
using myweb.Models;

namespace myweb.Services.Impl
{
    public class UserService : BaseService
    {
     

        public UserService() : base() {

        }
        public  ResultValueObject<UserInfo> addUser()
        {
            var _user = new UserInfo()
            {
                UserName = StringUtils.GetRandomString(5),
                Gender = UserInfoEnum.GenderEnum.MALE
            };
            _dbContext.UserInfos.Add(_user);
           var result =  _dbContext.SaveChanges();
            if (result > 0)
            {
                return ResultValueObject<UserInfo>.success(_user);
            }
            return ResultValueObject<UserInfo>.fail();

        }

       
    }
}
